package java0106;

public class Java03 {
    public static void main(String[] args) {

        //字符串类 java.lang.String
        //了解：字符串底层的本质是字符数组char[]
        String s1 = "张三";//['a','b','c','d','e']
        System.out.println(s1);

        //相等
        boolean a = "abc".equals("abc");
        System.out.println(a);

        boolean bcs = "bcs".equals("bcs");
        System.out.println(bcs);

        boolean anInt = "int".equals("int");
        System.out.println(anInt);

        boolean qwe = "qwe".equals("qwe");
        System.out.println(qwe);


        //查找
        int b = "abcde".indexOf("cd");
        System.out.println(b);

        int i = "qwerdf".indexOf("dw");
        System.out.println(i);

        int i1 = "qwerdf".indexOf("fq");
        System.out.println(i1);

        int i2 = "qwerdf".indexOf("rw");
        System.out.println(i2);

        //截取
        String c = "abcde".substring(1, 3);
        System.out.println(c);

        String q = "qwerdf".substring(0, 3);
        System.out.println(q);

        String substring = "qwerdf".substring(2, 3);
        System.out.println(substring);

        String substring1 = "qwerdf".substring(2, 4);
        System.out.println(substring1);


        //长度
        int d = "abcde".length();
        System.out.println(d);

        int length = "qwerdf".length();
        System.out.println(length);

        int length1 = "asdfqwf".length();
        System.out.println(length1);

        int length2 = "李奇隆dsb".length();
        System.out.println(length2);

        //去除两边空格方法
        String e = "  abc  ".trim();
        System.out.println(e);
        String trim = " we ".trim();
        System.out.println(trim);
        String trim1 = "  213  ".trim();

        //替换
        String f = "abc123abc123".replace("123", "张三");
        System.out.println(f);
        String replace = "李奇隆dsb".replace("dsb", "sb");
        System.out.println(replace);
        String replace1 = "lqleh".replace("eh", "sp");
        System.out.println(replace1);
        String replace2 = "lqlcnm".replace("cnm", "slb");
        System.out.println(replace2);

        //根据下标获取字符
        char g = "abcde".charAt(0);
        System.out.println(g);

        char c1 = "qwerdf".charAt(3);
        System.out.println(c1);
        char c2 = "wqerdf".charAt(2);
        System.out.println(c2);
        char c3 = "wqewqe".charAt(1);
        System.out.println(c3);

    }
}
